<?php
error_reporting(E_ALL);
require "user/UserEntity.php";
require "reg/Reg.php";
require "reg/RegBasicInfo.php";
require "reg/RegDetailInfo.php";
require "reg/RegComplete.php";

$tpl = "step1";//要加载的模板文件
session_start();

function getUser()
{
    $userData = [];
    if (isset($_SESSION['user'])){
        return json_decode($_SESSION['user']);
    }
}


if (isset($_GET['act'])){
    unset($_SESSION['user']);
    exit('清除用户注册数据成功');
}
if (!empty($_POST)){
    $regBasic = new RegBasicInfo();
    $regDetail = new RegDetailInfo();
    $regComplete = new RegComplete();


    $regBasic->setNextStep($regDetail);
    $regDetail->setNextStep($regComplete);

    $regBasic->stepNext(getUser());
}
$tpl = getUser() == null ? "step1" : getUser()->step;
include "tpl/head.html";
include "tpl/".$tpl.".html";
echo "<hr />";
echo "<div>当前用户信息：</div>";
echo "<pre>";
var_export(getUser());
echo "</pre>";
include "tpl/foot.html";